home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 February: Tool Chest / Dev.CD Feb 94.toast / Tool Chest / Development Platforms / MPW Related / MPW Interfaces / PInterfaces / QuickdrawText.p < prev    next >
Encoding:
Text File  |  1993-09-17  |  5.9 KB  |  177 lines  |  [TEXT/MPS ]

  1. {
  2.     File:        QuickdrawText.p
  3.  
  4.     Copyright:    © 1983-1993 by Apple Computer, Inc.
  5.                 All rights reserved.
  6.  
  7.     Version:    System 7.1 for ETO #11
  8.     Created:    Tuesday, March 30, 1993 18:00
  9.  
  10. }
  11.  
  12. {$IFC UNDEFINED UsingIncludes}
  13. {$SETC UsingIncludes := 0}
  14. {$ENDC}
  15.  
  16. {$IFC NOT UsingIncludes}
  17.  UNIT QuickdrawText;
  18.  INTERFACE
  19. {$ENDC}
  20.  
  21. {$IFC UNDEFINED UsingQuickdrawText}
  22. {$SETC UsingQuickdrawText := 1}
  23.  
  24. {$I+}
  25. {$SETC QuickdrawTextIncludes := UsingIncludes}
  26. {$SETC UsingIncludes := 1}
  27. {$IFC UNDEFINED UsingTypes}
  28. {$I $$Shell(PInterfaces)Types.p}
  29. {$ENDC}
  30. {$IFC UNDEFINED UsingIntlResources}
  31. {$I $$Shell(PInterfaces)IntlResources.p}
  32. {$ENDC}
  33. {$SETC UsingIncludes := QuickdrawTextIncludes}
  34.  
  35. CONST
  36.  
  37. { CharToPixel directions }
  38. leftCaret = 0;                                {Place caret for left block}
  39. rightCaret = -1;                                {Place caret for right block}
  40. hilite = 1;                                    {Direction is SysDirection}
  41.  
  42. smLeftCaret = 0;                                {Place caret for left block        obsolete }
  43. smRightCaret = -1;                                {Place caret for right block    obsolete }
  44. smHilite = 1;                                    {Direction is TESysJust            obsolete }
  45.  
  46. {Constants for styleRunPosition argument in PortionLine, DrawJustified,
  47.  MeasureJustified, CharToPixel, and PixelToChar.}
  48. onlyStyleRun = 0;                                { This is the only style run on the line }
  49. leftStyleRun = 1;                                { This is leftmost of multiple style runs on the line }
  50. rightStyleRun = 2;                                { This is rightmost of multiple style runs on the line }
  51. middleStyleRun = 3;                            { There are multiple style runs on the line and this 
  52.  is neither the leftmost nor the rightmost. }
  53. smOnlyStyleRun = 0;                                {      obsolete  }
  54. smLeftStyleRun = 1;                                {      obsolete  }
  55. smRightStyleRun = 2;                                {      obsolete  }
  56. smMiddleStyleRun = 3;                            {      obsolete  }
  57.  
  58. TYPE
  59.  
  60. { type for styleRunPosition parameter in PixelToChar etc. }
  61. JustStyleCode = INTEGER;
  62.  
  63. FontInfo = RECORD
  64.  ascent: INTEGER;
  65.  descent: INTEGER;
  66.  widMax: INTEGER;
  67.  leading: INTEGER;
  68.  END;
  69.  
  70. FormatOrder = ARRAY [0..0] OF INTEGER;
  71. FormatOrderPtr = ^FormatOrder;
  72. FormatStatus = INTEGER;
  73.  
  74.  
  75.  
  76. FUNCTION Pixel2Char(textBuf: Ptr;textLen: INTEGER;slop: INTEGER;pixelWidth: INTEGER;
  77.  VAR leadingEdge: BOOLEAN): INTEGER;
  78.  INLINE $2F3C,$820E,$0014,$A8B5;
  79. FUNCTION Char2Pixel(textBuf: Ptr;textLen: INTEGER;slop: INTEGER;offset: INTEGER;
  80.  direction: INTEGER): INTEGER;
  81.  INLINE $2F3C,$820C,$0016,$A8B5;
  82.  
  83.  {  New for 7.0  }
  84. FUNCTION PixelToChar(textBuf: Ptr;textLen: LONGINT;slop: Fixed;pixelWidth: Fixed;
  85.  VAR leadingEdge: BOOLEAN;VAR widthRemaining: Fixed;styleRunPosition: JustStyleCode;
  86.  numer: Point;denom: Point): INTEGER;
  87.  INLINE $2F3C,$8222,$002E,$A8B5;
  88. FUNCTION NPixel2Char(textBuf: Ptr;textLen: LONGINT;slop: Fixed;pixelWidth: Fixed;
  89.  VAR leadingEdge: BOOLEAN;VAR widthRemaining: Fixed;styleRunPosition: JustStyleCode;
  90.  numer: Point;denom: Point): INTEGER;
  91.  INLINE $2F3C,$8222,$002E,$A8B5;
  92. FUNCTION CharToPixel(textBuf: Ptr;textLen: LONGINT;slop: Fixed;offset: LONGINT;
  93.  direction: INTEGER;styleRunPosition: JustStyleCode;numer: Point;denom: Point): INTEGER;
  94.  INLINE $2F3C,$821C,$0030,$A8B5;
  95. FUNCTION NChar2Pixel(textBuf: Ptr;textLen: LONGINT;slop: Fixed;offset: LONGINT;
  96.  direction: INTEGER;styleRunPosition: JustStyleCode;numer: Point;denom: Point): INTEGER;
  97.  INLINE $2F3C,$821C,$0030,$A8B5;
  98. PROCEDURE DrawJustified(textPtr: Ptr;textLength: LONGINT;slop: Fixed;styleRunPosition: JustStyleCode;
  99.  numer: Point;denom: Point);
  100.  INLINE $2F3C,$8016,$0032,$A8B5;
  101. PROCEDURE NDrawJust(textPtr: Ptr;textLength: LONGINT;slop: Fixed;styleRunPosition: JustStyleCode;
  102.  numer: Point;denom: Point);
  103.  INLINE $2F3C,$8016,$0032,$A8B5;
  104. PROCEDURE MeasureJustified(textPtr: Ptr;textLength: LONGINT;slop: Fixed;charLocs: Ptr;
  105.  styleRunPosition: JustStyleCode;numer: Point;denom: Point);
  106.  INLINE $2F3C,$801A,$0034,$A8B5;
  107. PROCEDURE NMeasureJust(textPtr: Ptr;textLength: LONGINT;slop: Fixed;charLocs: Ptr;
  108.  styleRunPosition: JustStyleCode;numer: Point;denom: Point);
  109.  INLINE $2F3C,$801A,$0034,$A8B5;
  110. FUNCTION NPortionText(textPtr: Ptr;textLen: LONGINT;styleRunPosition: JustStyleCode;
  111.  numer: Point;denom: Point): Fixed;
  112.  INLINE $2F3C,$8412,$0036,$A8B5;
  113. FUNCTION PortionLine(textPtr: Ptr;textLen: LONGINT;styleRunPosition: JustStyleCode;
  114.  numer: Point;denom: Point): Fixed;
  115.  INLINE $2F3C,$8412,$0036,$A8B5;
  116.  
  117. PROCEDURE HiliteText(textPtr: Ptr;textLength: INTEGER;firstOffset: INTEGER;
  118.  secondOffset: INTEGER;VAR offsets: OffsetTable);
  119.  INLINE $2F3C,$800E,$001C,$A8B5;
  120. PROCEDURE DrawJust(textPtr: Ptr;textLength: INTEGER;slop: INTEGER);
  121.  INLINE $2F3C,$8008,$001E,$A8B5;
  122. PROCEDURE MeasureJust(textPtr: Ptr;textLength: INTEGER;slop: INTEGER;charLocs: Ptr);
  123.  INLINE $2F3C,$800C,$0020,$A8B5;
  124.  
  125. FUNCTION PortionText(textPtr: Ptr;textLen: LONGINT): Fixed;
  126.  INLINE $2F3C,$8408,$0024,$A8B5;
  127. FUNCTION VisibleLength(textPtr: Ptr;textLen: LONGINT): LONGINT;
  128.  INLINE $2F3C,$8408,$0028,$A8B5;
  129. PROCEDURE GetFormatOrder(ordering: FormatOrderPtr;firstFormat: INTEGER;
  130.  lastFormat: INTEGER;lineRight: BOOLEAN;rlDirProc: Ptr;dirParam: Ptr);
  131.  INLINE $2F3C,$8012,$FFFC,$A8B5;
  132.  
  133.  
  134. PROCEDURE TextFont(font: INTEGER);
  135.  INLINE $A887;
  136. PROCEDURE TextFace(face: Style);
  137.  INLINE $A888;
  138. PROCEDURE TextMode(mode: INTEGER);
  139.  INLINE $A889;
  140. PROCEDURE TextSize(size: INTEGER);
  141.  INLINE $A88A;
  142. PROCEDURE SpaceExtra(extra: Fixed);
  143.  INLINE $A88E;
  144. PROCEDURE DrawChar(ch: CHAR);
  145.  INLINE $A883;
  146. PROCEDURE DrawString(s: Str255);
  147.  INLINE $A884;
  148. PROCEDURE DrawText(textBuf: Ptr;firstByte: INTEGER;byteCount: INTEGER);
  149.  INLINE $A885;
  150. FUNCTION CharWidth(ch: CHAR): INTEGER;
  151.  INLINE $A88D;
  152. FUNCTION StringWidth(s: Str255): INTEGER;
  153.  INLINE $A88C;
  154. FUNCTION TextWidth(textBuf: Ptr;firstByte: INTEGER;byteCount: INTEGER): INTEGER;
  155.  INLINE $A886;
  156. PROCEDURE MeasureText(count: INTEGER;textAddr: Ptr;charLocs: Ptr);
  157.  INLINE $A837;
  158. PROCEDURE GetFontInfo(VAR info: FontInfo);
  159.  INLINE $A88B;
  160.  
  161. PROCEDURE CharExtra(extra: Fixed);
  162.  INLINE $AA23;
  163.  
  164. PROCEDURE StdText(count: INTEGER;textAddr: Ptr;numer: Point;denom: Point);
  165.  INLINE $A882;
  166. FUNCTION StdTxMeas(byteCount: INTEGER;textAddr: Ptr;VAR numer: Point;VAR denom: Point;
  167.  VAR info: FontInfo): INTEGER;
  168.  INLINE $A8ED;
  169.  
  170.  
  171. {$ENDC} { UsingQuickdrawText }
  172.  
  173. {$IFC NOT UsingIncludes}
  174.  END.
  175. {$ENDC}
  176.  
  177.